<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=div, initial-scale=1.0">
    <title>Document</title>
    <style>
        .header-logo {
            position: relative;
            margin-left: 200px;
            overflow: hidden;
        }

        .logo {
            display: block;
            width: 49px;
            height: 49px;
            background-color: orangered;
            text-align: center;
            line-height: 49px;
            text-indent: -200px;
            /* 将文字向左移动 */
        }

        .logo::before {
            position: absolute;
            content: "";
            left: 0;
            top: 0;
            width: 49px;
            height: 49px;
            background: url(./img/mi-logo.png) no-repeat center;
            transition: 0.5s;
            opacity: 1;

        }

        .logo::after {
            position: absolute;
            content: "";
            left: 0;
            top: 0;
            width: 49px;
            height: 49px;
            background: url(./img/mi-home.png) no-repeat center;
            margin-left: -49px;
            transition: 0.5s;
            opacity: 0;
            /* 透明度：完全透明的 */
        }

        .logo:hover::before {
            margin-left: 49px;
            opacity: 0;
        }

        .logo:hover::after {
            margin-left: 0px;
            opacity: 1;
        }
    </style>
</head>

<body>
    <div class="header-logo">
        <a href="#" class="logo" title="小米官网">小米官网</a>
    </div>
</body>

</html>